<script>
export default {
    onLaunch: function () {
        // #ifdef APP-NVUE
        plus.screen.lockOrientation('portrait-primary');

        let appid = plus.runtime.appid;
        if (appid && appid.toLocaleLowerCase() != "hbuilder") {
            uni.request({
                url: 'https://uniapp.dcloud.io/update', //检查更新的服务器地址
                data: {
                    appid: plus.runtime.appid,
                    version: plus.runtime.version
                },
                success: (res) => {
                    if (res.statusCode == 200 && res.data.isUpdate) {
                        let openUrl = plus.os.name === 'iOS' ? res.data.iOS : res.data.Android;
                        // 提醒用户更新
                        uni.showModal({
                            title: '更新提示',
                            content: res.data.note ? res.data.note : '是否选择更新',
                            success: (showResult) => {
                                if (showResult.confirm) {
                                    plus.runtime.openURL(openUrl);
                                }
                            }
                        })
                    }
                }
            })
        }

        var domModule = weex.requireModule('dom');
        domModule.addRule('fontFace', {
            'fontFamily': "texticons",
            'src': "url('./static/text-icon.ttf')"
        });
        // #endif
    },
    onShow: async function () {
       const token = uni.getStorageSync('token')
       console.log();
       if(token){
        global.getUser({})
       }else{
        
       }
       const list = await this.$api.getCountryArea({})
       uni.setStorageSync('country_area', list.list)
    },
    onHide: function () {
        console.log('App Hide')
    }
}
</script>

<style>
/*每个页面公共css */
.space-between {
    display: flex;
    justify-content: space-between;

}

.flex {
    display: flex;
    flex-wrap: wrap;
}

.align-center {
    display: flex;
    align-items: center;
}

.vertical-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.between-center {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mainPadding {
    padding: 0px 40px 0px 40px;
}


.flexRight {
    display: flex;
    justify-content: flex-end;
}



.operaButton {
    font-size: 12px;
    padding: 0px 4px;
    height: 32px;
}

.normalStatic {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.85);
    font-weight: normal;
}

.center-cell {
    text-align: center;
    padding: 0px 0px !important;
}


.sticky {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 9;
}
.ellipsis {
    display: inline-block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ellipsisTwo {
    overflow: hidden;

    text-overflow: ellipsis;

    display: -webkit-box;

    -webkit-line-clamp: 2;

    -webkit-box-orient: vertical;
}
.button {
    background-color: #3180FF;
    border-radius: 20upx;
    color: white;
    border: none;
  }
</style>
